SpatialStream® Code Examples

Postal Code Boundaries and Labels

Using SpatialStream® Postal Code Boundaries, SLD, and GetMap components, you can access nationwide postal code boundaries and basic attributes for display in your mapping application. This example will demonstrate how to add postal code boundaries and postal code labels for the entire US (Southern California shown in sample). The SLD (Stylized Layer Descriptor) component allows you to add labels based on attributes in the postal code boundaries and tailor the following display parameters of your postal code: boundary color, boundary width, fill color, opacity, label color, and label size. Once the SLD is defined, the GetMap component generates the overlay for your map.

Postal Code Boundaries | GetMap | SLD

var postalcode = new Dmp.Layer.WMSLayer("boundary", "SS", {
antiAlias: true
});
postalcode.addChild("postalcodePoly", "DMP_LICENSE/POSTALCODE", "$(ACCOUNT_FOLDER)SLD/SimpleBoundary.sld.xml", {
zoomRange: {
min: 7, max: 19
}
});
postalcode.addChild("postalcodeLabel", "DMP_LICENSE/POSTALCODE", "$(ACCOUNT_FOLDER)SLD/PostalCodeLabel.sld.xml", {
zoomRange: {
min: 10, max: 19
}
});
map.addLayer(postalcode);


Run Sample   Back To Index